
import pywebio


def main():

    pywebio.session.set_env(input_panel_fixed=False, output_animation=False)
    pywebio.output.put_markdown("""
    # 自然语言查询
    """)
    pywebio.pin.put_select('model', ["qwen-1.8b", "qwen-72b"], label='Model')

    # pin_on_change('model', lambda v: bot.set_model(v))
    while True:
        form = pywebio.input.input_group('', [
            pywebio.input.input(name='msg', placeholder='Ask AI'),
            pywebio.input.actions(name='cmd', buttons=['Send'])
        ])



        from hints.hints import hint

        my_msg = form['msg']
        pywebio.output.put_info(pywebio.output.put_text(my_msg, inline=True))
        user_msg = hint
        user_msg += my_msg

        if not user_msg:
            continue


        from output_parsing.parser import parsing

        parsing(user_msg)




if __name__ == '__main__':
    from pywebio import start_server

    start_server(main, port=8081, debug=True, cdn=False)